import store from '@/store'
// import { getInfo } from '@/api/login'
export default async function (to, from, next) {
	if (!to.path.startsWith('/11837')) {
		return
	}

	if (!store.getters.info) {
		if (store.getters.token) {
			try {
				await store.dispatch('getInfo')
				next()
				return
			} catch (err) {
				console.log(err)
			}
		}
		if (whiteList.indexOf(to.path) == -1) {
			next('/11837/login')
		}
	}
}

export const whiteList = ['/11837/login', '/11837/input']
